<template>
  <div class="enterprise-home">
    <!-- 顶部导航栏 -->
    <header class="header">
      <div class="header-container">
        <!-- Logo和标题 -->
        <div class="logo-section">
          <img src="../../assets/images/login/logo2.png" class="logo-image" />
          <span class="logo-text">{{ $t('enterpriseHome.logoTitle') }}</span>
        </div>
        
        <!-- 导航菜单 -->
        <nav class="nav-menu">
          <div
            v-for="(item, index) in navItems"
            :key="index"
            class="nav-item"
            :class="{ active: item.active }"
            @click="handleNavClick(item)"
            >
              {{ $t(item.nameKey) }}
          </div>
        </nav>
        
        <!-- 右侧按钮 -->
        <div class="header-buttons">
          <!-- 登录状态下显示用户操作按钮 -->
          <div v-if="isLoggedIn" class="user-actions">
            <el-icon class="notification-bell" size="20" @click="goToNotifications"><Bell /></el-icon>
            <span class="action-item" @click="handleDropdownCommand('enterprise-center')">{{ $t('enterpriseHome.enterpriseCenter') }}</span>
            <span class="action-item" @click="handleDropdownCommand('logout')">{{ $t('enterpriseHome.logout') }}</span>
          </div>
          
          <!-- 未登录状态下显示登录按钮 -->
          <el-button
            v-else
            type="primary"
            class="btn-login"
            @click="handleLogin"
          >
            {{ $t('enterpriseHome.login') }}
          </el-button>
        </div>
      </div>
    </header>

    <!-- 主横幅区域 -->
    <section class="hero-section">
      <!-- 轮播图背景 -->
      <div class="banner-carousel" v-if="!bannerLoading && !bannerError && bannerImages.length > 0">
        <div class="banner-slide" 
          v-for="(banner, index) in bannerImages" 
          :key="index"
          :class="{ active: currentBannerIndex === index }"
          :style="{ backgroundImage: `url(${banner})` }">
        </div>
        <!-- 轮播指示器 -->
        <div class="banner-indicators" v-if="bannerImages.length > 1">
          <div 
            v-for="(banner, index) in bannerImages" 
            :key="index"
            class="banner-indicator"
            :class="{ active: currentBannerIndex === index }"
            @click="goToBannerSlide(index)">
          </div>
        </div>
      </div>
      
      <!-- 整个轮播图区域的蒙版 -->
      <div class="hero-overlay"></div>
      
      <!-- 加载状态 -->
      <div class="banner-loading" v-if="bannerLoading">
        <el-icon class="loading-icon"><Loading /></el-icon>
      </div>
      
      <div class="hero-content">
          <!-- 主标题图片 -->
        <div class="hero-title">
          <img
            class="title-image"
            :alt="$t('enterpriseHome.heroTitleAlt')"
            src="@/assets/images/login/首页字体.png"
          />
        </div>
          
          <!-- 搜索框 -->
        <div class="search-container">
          <div class="search-box">
              <el-input
                v-model="searchKeyword"
              class="search-input"
              :placeholder="$t('enterpriseHome.searchPlaceholder')"
                size="large"
                @keyup.enter="handleSearch"
              />
              <el-button
                type="primary"
                circle
              class="search-button"
                @click="handleSearch"
              >
                <el-icon><Search /></el-icon>
              </el-button>
            </div>
          </div>
        </div>
      </section>


    <!-- 全球精英人才库区域 -->
    <section class="mission-section">
      <div class="mission-container">
        <h2 class="mission-title">
          {{ $t('enterpriseHome.missionTitle') }}
        </h2>
        
        <p class="mission-description">
          {{ $t('enterpriseHome.missionDescription') }}
        </p>
        
          <el-button
            type="primary"
          class="mission-btn"
            @click="exploreOpportunities"
          >
          {{ $t('enterpriseHome.missionButton') }}
          </el-button>
        </div>
      </section>

    <!-- 服务特色区域 -->
    <section class="service-features-section">
      <div class="service-features-container">
        <div class="service-cards-grid">
          <!-- 国际人才培养卡片 -->
          <div class="service-card talent-card">
            <div class="card-background">
              <img src="@/assets/images/effects/图1.jpg" alt="国际人才培养" class="card-image" />
            </div>
            <div class="card-overlay"></div>
            <div class="card-content">
              <h3 class="card-title vertical-text">{{ $t('enterpriseHome.talentTraining') }}</h3>
              <p class="card-description">
                {{ $t('enterpriseHome.talentTrainingDesc') }}
              </p>
              </div>
            </div>

          <!-- 跨境资源对接卡片 -->
          <div class="service-card resource-card">
            <div class="card-background">
              <img src="@/assets/images/effects/图2.png" alt="跨境资源对接" class="card-image" />
            </div>
            <div class="card-overlay"></div>
            <div class="card-content">
              <h3 class="card-title vertical-text">{{ $t('enterpriseHome.resourceConnection') }}</h3>
              <div class="card-icon">
                <div class="shield-icon"></div>
              </div>
              </div>
            </div>

          <!-- 专业服务保障卡片 -->
          <div class="service-card service-card-wide">
            <div class="card-background">
              <img src="@/assets/images/effects/图3.jpg" alt="专业服务保障" class="card-image" />
            </div>
            <div class="card-overlay"></div>
            <div class="card-content">
              <h3 class="card-title vertical-text">{{ $t('enterpriseHome.serviceGuarantee') }}</h3>
              </div>
            </div>

          <!-- 安全隐私保护卡片 -->
          <div class="service-card security-card">
            <div class="card-background">
              <img src="@/assets/images/effects/图4.png" alt="安全隐私保护" class="card-image" />
            </div>
            <div class="card-overlay"></div>
            <div class="card-content">
              <h3 class="card-title vertical-text">{{ $t('enterpriseHome.privacyProtection') }}</h3>
              </div>
            </div>
          </div>
        </div>
      </section>


    <!-- 定制化需求发布区域 -->
    <section class="discover-talent-section">
      <div class="discover-container">
        <div class="discover-content">
          <h2 class="discover-title">
            {{ $t('enterpriseHome.demandTitle') }}
          </h2>
          
          <div class="discover-description">
            <p class="desc-text">
              {{ $t('enterpriseHome.demandDescription') }}
            </p>
          </div>
          
          <div class="discover-action">
            <el-button 
              type="primary" 
              size="large"
              class="discover-btn"
              @click="discoverTalents"
            >
              {{ $t('enterpriseHome.demandButton') }}
              <el-icon class="ml-2"><ArrowRight /></el-icon>
            </el-button>
          </div>
        </div>
      </div>
    </section>

    <!-- 企业资质认证区域 -->
    <section class="our-culture-section">
      <div class="culture-container">
        <div class="culture-layout">
          <!-- 左侧文字内容 -->
          <div class="culture-content">
            <h2 class="culture-title">
              {{ $t('enterpriseHome.certificationTitle') }}
            </h2>
            
            <div class="culture-description">
              <p class="culture-text">
                {{ $t('enterpriseHome.certificationDescription') }}
              </p>
            </div>
            
            <div class="culture-action">
              <el-button 
                type="primary" 
                size="large"
                class="culture-btn"
                @click="learnMoreCulture"
              >
                {{ $t('enterpriseHome.certificationButton') }}
              </el-button>
            </div>
          </div>
          
          <!-- 右侧图片网格 -->
          <div class="culture-images">
            <div class="images-grid">
              <div class="image-item image-1">
                <img src="@/assets/images/effects/团队1.jpg" :alt="$t('enterpriseHome.teamCulture1')" class="team-image" />
              </div>
              <div class="image-item image-2">
                <img src="@/assets/images/effects/团队2.jpeg" :alt="$t('enterpriseHome.teamCulture2')" class="team-image" />
              </div>
              <div class="image-item image-3">
                <img src="@/assets/images/effects/团队3.jpg" :alt="$t('enterpriseHome.teamCulture3')" class="team-image" />
              </div>
              <div class="image-item image-4">
                <img src="@/assets/images/effects/团队4.jpg" :alt="$t('enterpriseHome.teamCulture4')" class="team-image" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 我们的承诺区域 -->
    <section class="our-promise-section">
      <div class="promise-container">
        <h2 class="promise-title">{{ $t('enterpriseHome.promiseTitle') }}</h2>
        
        <div class="promise-content">
          <p class="promise-text">
            {{ $t('enterpriseHome.promiseText1') }}
          </p>
          <p class="promise-text">
            {{ $t('enterpriseHome.promiseText2') }}
          </p>
          <p class="promise-text">
            {{ $t('enterpriseHome.promiseText3') }}
          </p>
          
          <p class="promise-highlight">
            {{ $t('enterpriseHome.promiseHighlight') }}
          </p>
        </div>
      </div>
    </section>

    <!-- Footer区域 -->
    <footer class="main-footer">
      <div class="footer-container">
        <div class="footer-content">
          <!-- 左侧：社交媒体和版权信息 -->
          <div class="footer-left">
            <div class="social-section">
              <p class="follow-text">{{ $t('enterpriseHome.followUs') }}</p>
              <div class="social-links">
                <a href="#" class="social-link tiktok" @click.prevent="openSocialMedia('tiktok')">
                  <img src="@/assets/images/effects/图标1.png" alt="TikTok" class="social-icon-img" />
                </a>
                <a href="#" class="social-link wechat" @click.prevent="openSocialMedia('wechat')">
                  <img src="@/assets/images/effects/图标2.png" alt="WeChat" class="social-icon-img" />
                </a>
                <a href="#" class="social-link weibo" @click.prevent="openSocialMedia('weibo')">
                  <img src="@/assets/images/effects/图标3.png" alt="Weibo" class="social-icon-img" />
                </a>
                <a href="#" class="social-link qq" @click.prevent="openSocialMedia('qq')">
                  <img src="@/assets/images/effects/图标4.png" alt="QQ" class="social-icon-img" />
                </a>
              </div>
            </div>
            
            <div class="copyright-section">
              <div class="copyright-info">
                <span class="copyright-icon">🔒</span>
                <span class="copyright-text">{{ $t('enterpriseHome.copyright') }}</span>
              </div>
            </div>
          </div>
          
          <!-- 中间：联系我们 -->
          <div class="footer-center">
            <h4 class="contact-title">{{ $t('enterpriseHome.contactUs') }}</h4>
          </div>
          
          <!-- 右侧：按钮、导航链接和回到顶部 -->
          <div class="footer-right">
            <div class="footer-buttons">
              <el-button 
                class="footer-btn"
                @click="downloadApp"
              >
                {{ $t('enterpriseHome.wechatMiniProgram') }}
              </el-button>
              <el-button 
                class="footer-btn"
                @click="visitOfficialWebsite"
              >
                {{ $t('enterpriseHome.officialWebsite') }}
              </el-button>
            </div>
            
            <div class="sites-section">
              <h4 class="sites-title">{{ $t('enterpriseHome.relatedSites') }}</h4>
              <div class="nav-links">
                <a href="#" @click.prevent="goToPage('enterprise')" class="nav-link">{{ $t('enterpriseHome.enterprise') }}</a>
                <a href="#" @click.prevent="goToPage('student')" class="nav-link">{{ $t('enterpriseHome.student') }}</a>
                <a href="#" @click.prevent="goToPage('about')" class="nav-link">{{ $t('enterpriseHome.about') }}</a>
                <a href="#" @click.prevent="goToPage('talent')" class="nav-link">{{ $t('enterpriseHome.talentLibrary') }}</a>
              </div>
            </div>
            
            <div class="back-to-top" @click="scrollToTop">
              <el-icon><ArrowUp /></el-icon>
            </div>
          </div>
        </div>
      </div>
    </footer>

    <!-- 公告详情弹窗 -->
    <el-dialog
      v-model="showDetailDialog"
      :title="$t('enterpriseHome.announcementDetail')"
      width="80%"
      max-width="800px"
    >
      <div v-if="selectedAnnouncement" class="announcement-detail">
        <div class="detail-header">
          <img :src="selectedAnnouncement.image" :alt="selectedAnnouncement.title" class="detail-image" />
          <h3 class="detail-title">{{ selectedAnnouncement.fullTitle }}</h3>
          </div>

        <div class="detail-content">
          <div v-html="selectedAnnouncement.fullContent"></div>
            </div>

        <div class="detail-actions">
          <el-button type="primary" @click="applyNow(selectedAnnouncement)">
            {{ $t('enterpriseHome.applyNow') }}
                </el-button>
          <el-button @click="showDetailDialog = false">
            {{ $t('enterpriseHome.close') }}
                </el-button>
              </div>
            </div>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { Search, ArrowRight, ArrowUp, ArrowDown, Loading } from '@element-plus/icons-vue'
import request, { TokenManager } from '@/utils/request'
import { useI18n } from 'vue-i18n'
import config from '@/config'

const { t, locale } = useI18n()

const router = useRouter()

// 语言检测逻辑
const detectLanguage = () => {
  const savedLang = localStorage.getItem('lang')
  if (savedLang && (savedLang === 'zh' || savedLang === 'en')) {
    locale.value = savedLang
  } else {
    // 如果没有保存的语言设置，默认使用中文
    locale.value = 'zh'
    localStorage.setItem('lang', 'zh')
  }
}

// 响应式数据
const searchKeyword = ref('')
const showDetailDialog = ref(false)
const selectedAnnouncement = ref(null)
const userEmail = ref('')
const isLoggedIn = ref(false)

// 轮播图数据
const bannerImages = ref([])
const currentBannerIndex = ref(0)
let bannerAutoPlayTimer = null
const bannerLoading = ref(true)
const bannerError = ref(false)
const isTestMode = ref(false) // 测试模式标志

// 轮播控制
const currentIndex = ref(0)
const cardWidth = ref(800) // 卡片宽度
const cardGap = ref(40) // 卡片间距
let autoPlayTimer = null // 自动播放定时器

// 人才轮播控制
const talentCurrentIndex = ref(0)
const talentCardWidth = ref(150) // 人才卡片宽度
let talentAutoPlayTimer = null // 人才轮播自动播放定时器
const centerIndex = ref(3) // 中心位置索引（显示7个，中心是第4个，索引为3）
const visibleCount = 7 // 可见的人才数量

// 公告数据
const announcements = ref([
  {
    id: 1,
    title: '华为 | 数学与通信底层算法突破计划',
    description: '为突破香农极限理论瓶颈，华为中央研究院面向全球招募数学与算法天才青年（23-28岁），主攻6G通信、光子拓扑加密、高维信号编解码等"无人区"技术。',
    image: '/src/assets/images/effects/公告2.jpeg',
    fullTitle: '【天才招募】华为2024「数学π计划」启动！年薪201万+，攻克5.5G通信底层极限',
    fullContent: `
      <div class="announcement-full-content">
        <h4>核心内容：</h4>
        <p>为突破香农极限理论瓶颈，华为中央研究院面向全球招募数学与算法天才青年（23-28岁），主攻6G通信、光子拓扑加密、高维信号编解码等"无人区"技术。</p>
        
        <h4>岗位亮点：</h4>
        <h5>研究方向：</h5>
        <ul>
          <li>✅ 非正交多址接入（NOMA）算法重构</li>
          <li>✅ 量子信道容量证明</li>
          <li>✅ 抗干扰通信的几何代数模型</li>
        </ul>
        
        <h5>资源支持：</h5>
        <ul>
          <li>✦ 直通任正非人才通道，预算无上限</li>
          <li>✦ 联合菲尔兹奖导师团（巴黎高师+普林斯顿）</li>
        </ul>
        
        <h5>硬性要求：</h5>
        <p>‼ IMO/IPhO金牌得主 或 SIAM期刊一作≥3篇</p>
        
        <h4>应聘方式：</h4>
        <p>网申链接：career.huawei.com/π-plan<br/>
        内推暗号：<strong>HMATH24</strong>（简历免筛直通终面）<br/>
        注：2023届入选者论文已登顶《Nature Physics》，解决毫米波衍射难题</p>
      </div>
    `
  },
  {
    id: 2,
    title: '字节跳动 | TikTok全球化合规攻坚组',
    description: '应对欧盟DSA法案、美国州级隐私诉讼、东南亚数据本地化政策，建立10亿级用户实时防护体系。',
    image: '/src/assets/images/effects/公告1.jpg',
    fullTitle: '【紧急部署】字节跳动TikTok电商招募全球数据合规官！首年期权价值超百万美金',
    fullContent: `
      <div class="announcement-full-content">
        <h4>核心痛点解决方案：</h4>
        <p>应对欧盟DSA法案、美国州级隐私诉讼、东南亚数据本地化政策，建立10亿级用户实时防护体系：</p>
        
        <h5>技术方向：</h5>
        <ul>
          <li>🔒 动态数据脱敏引擎开发（支持200+司法管辖区）</li>
          <li>🔒 跨境隐私计算沙盒（联邦学习+同态加密）</li>
          <li>🔒 直播电商实时审计系统（风险拦截<0.1s）</li>
        </ul>
        
        <h5>人才画像：</h5>
        <ul>
          <li>✅ 精通GDPR/CCPA/东盟DPA法律框架</li>
          <li>✅ 有AWS KMS或Azure Vault架构经验</li>
          <li>✅ 英语/法语/印尼语专业级</li>
        </ul>
        
        <h4>薪酬威慑力：</h4>
        <p><strong>BASE：</strong>硅谷同级岗位150%薪资（$280K-$450K）<br/>
        <strong>激励：</strong>解决重大合规漏洞奖金≈单次$1M</p>
        
        <h4>急速通道：</h4>
        <p>投递邮箱：tiktok.defender@bytedance.com<br/>
        主题注明：【DataShield】-姓名-原雇主（如Meta/BNP Paribas）</p>
      </div>
    `
  },
  {
    id: 3,
    title: '比亚迪 | 高端车型「仰望」全栈研发军团',
    description: '为突破百万豪车技术封锁，实现三电系统（CTB+800V Sic）+智能座舱（天神之眼4.0）全栈自研。',
    image: '/src/assets/images/effects/公告3.jpg',
    fullTitle: '【技术总攻】比亚迪「仰望」超电团队千人扩编！全栈汽车工程师年薪90万+',
    fullContent: `
      <div class="announcement-full-content">
        <h4>攻坚任务书：</h4>
        <p>为突破百万豪车技术封锁，实现三电系统（CTB+800V Sic）+智能座舱（天神之眼4.0）全栈自研：</p>
        
        <table class="tech-requirements">
          <thead>
            <tr>
              <th>模块</th>
              <th>技术指标</th>
              <th>人才需求</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>电池系统</td>
              <td>能量密度≥300Wh/kg</td>
              <td>固态电解质研发专家（博士+）</td>
            </tr>
            <tr>
              <td>电驱控制</td>
              <td>零百加速2.1秒抗扭矩波动</td>
              <td>电磁兼容首席工程师</td>
            </tr>
            <tr>
              <td>智能座舱</td>
              <td>AR-HUD融合大模型语音助手</td>
              <td>Qt/C++系统开发（5年经验）</td>
            </tr>
          </tbody>
        </table>
        
        <h4>实验室资源曝光：</h4>
        <ul>
          <li>风洞实验室：模拟-50℃极地工况</li>
          <li>刀片电池针刺测试场（全球最大）</li>
          <li>毫米波雷达暗室（120dB背景噪声）</li>
        </ul>
        
        <h4>应聘特权：</h4>
        <ul>
          <li>✦ 通过者赠仰望U8工程车1年使用权</li>
          <li>✦ 子女优先入读比亚迪国际学校（IB体系）</li>
        </ul>
        
        <p><strong>投递截止：</strong>2024年4月30日<br/>
        <strong>扫码直达：</strong>https://static.byd.com/career/qr-2024-u8</p>
      </div>
    `
  }
])

// 人才数据
const talents = ref([
  {
    id: 1,
    name: '张明',
    image: '/src/assets/images/login/1.png',
    bgColor: '#E8D5B7'
  },
  {
    id: 2,
    name: '李华',
    image: '/src/assets/images/login/2.jpg',
    bgColor: '#F5F5F5'
  },
  {
    id: 3,
    name: '王强',
    image: '/src/assets/images/login/3.jpg',
    bgColor: '#FF8C00'
  },
  {
    id: 4,
    name: '刘洋',
    image: '/src/assets/images/login/4.jpg',
    bgColor: '#E6E6FA'
  },
  {
    id: 5,
    name: '陈红',
    image: '/src/assets/images/login/5.jpg',
    bgColor: '#20B2AA'
  },
  {
    id: 6,
    name: '赵军',
    image: '/src/assets/images/login/6.jpg',
    bgColor: '#B0C4DE'
  },
  {
    id: 7,
    name: '周丽',
    image: '/src/assets/images/login/7.jpg',
    bgColor: '#40E0D0'
  },
  {
    id: 8,
    name: '吴磊',
    image: '/src/assets/images/login/8.png',
    bgColor: '#40E0D0'
  }
])

// 计算属性 - 生成环形显示的人才列表
const displayedTalents = computed(() => {
  const result = []
  const totalTalents = talents.value.length
  
  for (let i = 0; i < visibleCount; i++) {
    // 计算实际的人才索引，支持环形循环
    const actualIndex = (talentCurrentIndex.value - centerIndex.value + i + totalTalents) % totalTalents
    const talent = talents.value[actualIndex]
    result.push({
      ...talent,
      originalIndex: actualIndex
    })
  }
  
  return result
})

// 职位分类数据
const jobCategories = ref([
  { id: 1, name: 'UI设计师', count: 128 },
  { id: 2, name: '现场工程师', count: 95 },
  { id: 3, name: '数据分析师', count: 76 },
  { id: 4, name: '软件工程师', count: 203 },
  { id: 5, name: '销售代表', count: 89 },
  { id: 6, name: '合规管理员', count: 45 },
  { id: 7, name: '客户经理', count: 67 },
  { id: 8, name: '设备维修工程师', count: 34 }
])

// 导航项
const navItems = ref([
  { name: '申请列表', nameKey: 'enterpriseHome.applicationList', active: false, route: '/code/enterprise/application-records' },
  { name: '人才库', nameKey: 'enterpriseHome.talentLibrary', active: false, route: '/code/enterprise/talent-search' }
])

// 方法
const handleNavClick = (item) => {
  // 更新激活状态
  navItems.value.forEach(nav => nav.active = false)
  item.active = true
  
  // 跳转到对应页面
  if (item.route) {
    router.push(item.route)
  }
}



// 检查用户登录状态
const checkUserStatus = () => {
  const hasToken = TokenManager.isLoggedIn()
  const userType = TokenManager.getUserType()
  
  if (hasToken && userType === 'enterprise') {
    isLoggedIn.value = true
    userEmail.value = localStorage.getItem('user_email') || ''
  } else {
    isLoggedIn.value = false
    userEmail.value = ''
  }
}

// 跳转到通知页面
const goToNotifications = () => {
  router.push('/code/enterprise/notifications')
}

// 处理下拉菜单命令
const handleDropdownCommand = (command) => {
  switch (command) {
    case 'enterprise-center':
      // 跳转到企业中心
      router.push('/code/enterprise/space')
      break
    case 'logout':
      // 退出登录
      handleLogout()
      break
  }
}

// 退出登录
const handleLogout = () => {
  // 清除本地存储的用户信息
  localStorage.removeItem('access_token')
  localStorage.removeItem('user_email')
  localStorage.removeItem('refresh_token')
  
  // 更新状态
  isLoggedIn.value = false
  userEmail.value = ''
  
  ElMessage.success('已退出登录')
  
  // 可选：跳转到首页或登录页
  // router.push('/qiyedenglu')
}

const handleLogin = () => {
  // 跳转到企业登录页面
  router.push('/qiyedenglu')
}

const handleSearch = () => {
  if (searchKeyword.value.trim()) {
    // 跳转到人才搜索页面并传递搜索关键词
    router.push({
      path: '/code/enterprise/talent-search',
      query: { keyword: searchKeyword.value.trim() }
    })
    ElMessage.success(t('enterpriseHome.searchingFor', { keyword: searchKeyword.value }))
  } else {
    ElMessage.warning(t('enterpriseHome.pleaseEnterKeyword'))
  }
}

// 公告相关方法
const showAnnouncementDetail = (announcement) => {
  selectedAnnouncement.value = announcement
  showDetailDialog.value = true
}

const applyNow = (announcement) => {
  ElMessage.success(t('enterpriseHome.goingToApplicationPage', { title: announcement.title }))
  showDetailDialog.value = false
  // 这里可以添加跳转到具体申请页面的逻辑
}

// 轮播控制方法
const nextSlide = () => {
  if (currentIndex.value < announcements.value.length - 1) {
    currentIndex.value++
  } else {
    currentIndex.value = 0 // 循环到第一个
  }
}

const prevSlide = () => {
  if (currentIndex.value > 0) {
    currentIndex.value--
  } else {
    currentIndex.value = announcements.value.length - 1 // 循环到最后一个
  }
}

const goToSlide = (index) => {
  currentIndex.value = index
  resetAutoPlay() // 重置自动播放
}

// 自动播放相关方法
const startAutoPlay = () => {
  autoPlayTimer = setInterval(() => {
    nextSlide()
  }, 5000) // 每5秒切换
}

const stopAutoPlay = () => {
  if (autoPlayTimer) {
    clearInterval(autoPlayTimer)
    autoPlayTimer = null
  }
}

const resetAutoPlay = () => {
  stopAutoPlay()
  startAutoPlay()
}

// 轮播图控制方法
const nextBannerSlide = () => {
  if (currentBannerIndex.value < bannerImages.value.length - 1) {
    currentBannerIndex.value++
  } else {
    currentBannerIndex.value = 0 // 循环到第一个
  }
}

const prevBannerSlide = () => {
  if (currentBannerIndex.value > 0) {
    currentBannerIndex.value--
  } else {
    currentBannerIndex.value = bannerImages.value.length - 1 // 循环到最后一个
  }
}

const goToBannerSlide = (index) => {
  currentBannerIndex.value = index
  resetBannerAutoPlay() // 重置自动播放
}

// 自动播放相关方法
const startBannerAutoPlay = () => {
  bannerAutoPlayTimer = setInterval(() => {
    nextBannerSlide()
  }, 5000) // 每5秒切换
}

const stopBannerAutoPlay = () => {
  if (bannerAutoPlayTimer) {
    clearInterval(bannerAutoPlayTimer)
    bannerAutoPlayTimer = null
  }
}

const resetBannerAutoPlay = () => {
  stopBannerAutoPlay()
  startBannerAutoPlay()
}

// 获取轮播图数据
const fetchBannerImages = async () => {
  bannerLoading.value = true
  bannerError.value = false
  
  // 检查是否有token，如果没有token则直接使用本地图片
  const hasToken = TokenManager.isLoggedIn()
  
  if (!hasToken) {
    console.log('无token，使用本地轮播图')
    setTimeout(() => {
      bannerImages.value = [
        '@/assets/images/login/首页背景.png',
        '@/assets/images/login/首页图片2.jpg', 
        '@/assets/images/login/首页图片3.jpg'
      ]
      bannerLoading.value = false
    }, 500)
    return
  }
  
  // 测试模式 - 如果API不可用，可以设置为true进行测试
  if (isTestMode.value) {
    setTimeout(() => {
      bannerImages.value = [
        '@/assets/images/login/首页背景.png',
        '@/assets/images/login/首页图片2.jpg',
        '@/assets/images/login/首页图片3.jpg'
      ]
      bannerLoading.value = false
      console.log('测试模式: 使用本地图片')
    }, 1000)
    return
  }
  
  try {
    // 使用统一的request工具，会自动添加token
    const response = await request.get('/api/api/v1/admin/banner/list')
    console.log('Banner API response:', response) // 调试输出
    
    if (response && response.success) {
      // 确保数据是数组
      if (Array.isArray(response.data) && response.data.length > 0) {
        // 处理图片URL，确保完整路径
        const baseUrl = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8090'
        bannerImages.value = response.data.map(path => {
          // 如果路径已经是完整URL，直接使用
          if (path.startsWith('http://') || path.startsWith('https://')) {
            return path
          }
          // 生产环境使用baseURL，开发环境使用相对路径
          const isProduction = import.meta.env.PROD
          if (isProduction && config.baseURL) {
            // 生产环境：使用baseURL拼接
            const cleanPath = path.startsWith('/') ? path.slice(1) : path
            return `${config.baseURL}/${cleanPath}`
          } else {
            // 开发环境：使用相对路径，让代理处理
            return path.startsWith('/') ? path : '/' + path
          }
        })
        console.log('处理后的轮播图数据:', bannerImages.value)
      } else {
        console.warn('API返回的轮播图数据为空或格式不正确，使用本地图片')
        // 如果API返回空数据，使用本地图片
        bannerImages.value = [
          '@/assets/images/login/首页背景.png',
          '@/assets/images/login/首页图片2.jpg',
          '@/assets/images/login/首页图片3.jpg'
        ]
      }
    } else {
      console.error('获取轮播图失败:', response?.message || '未知错误')
      // 如果API失败，使用本地图片
      bannerImages.value = [
        '@/assets/images/login/首页背景.png',
        '@/assets/images/login/首页图片2.jpg',
        '@/assets/images/login/首页图片3.jpg'
      ]
    }
  } catch (error) {
    console.error('获取轮播图出错:', error)
    // 如果API异常，使用本地图片
    bannerImages.value = [
      '@/assets/images/login/首页背景.png',
      '@/assets/images/login/首页图片2.jpg',
      '@/assets/images/login/首页图片3.jpg'
    ]
    
    // 如果是401错误，说明token无效，但不影响轮播图显示
    if (error.response?.status === 401) {
      console.log('Token无效，使用本地轮播图')
    }
  } finally {
    bannerLoading.value = false
  }
}

// 生命周期钩子
onMounted(() => {
  detectLanguage() // 检测并设置语言
  fetchBannerImages() // 获取轮播图数据
  startBannerAutoPlay() // 启动轮播图自动播放
  startAutoPlay()
  startTalentAutoPlay()
  checkUserStatus()
})

onUnmounted(() => {
  stopBannerAutoPlay() // 停止轮播图自动播放
  stopAutoPlay()
  stopTalentAutoPlay()
})

// 探索人才库方法
const exploreOpportunities = () => {
  ElMessage.success(t('enterpriseHome.goingToTalentLibrary'))
  router.push('/code/enterprise/talent-search')
}

// 人才轮播控制方法
const nextTalent = () => {
  talentCurrentIndex.value = (talentCurrentIndex.value + 1) % talents.value.length
}

const prevTalent = () => {
  talentCurrentIndex.value = (talentCurrentIndex.value - 1 + talents.value.length) % talents.value.length
}

// 点击人才直接跳转到该人才为中心
const goToTalent = (targetIndex) => {
  talentCurrentIndex.value = targetIndex
  resetTalentAutoPlay()
}

// 人才轮播自动播放
const startTalentAutoPlay = () => {
  talentAutoPlayTimer = setInterval(() => {
    nextTalent()
  }, 3000) // 每3秒切换
}

const stopTalentAutoPlay = () => {
  if (talentAutoPlayTimer) {
    clearInterval(talentAutoPlayTimer)
    talentAutoPlayTimer = null
  }
}

const resetTalentAutoPlay = () => {
  stopTalentAutoPlay()
  startTalentAutoPlay()
}

// 职位筛选相关方法
const handleJobCategoryClick = (category) => {
  ElMessage.success(t('enterpriseHome.searchingForCategory', { category: category.name }))
  // 跳转到人才搜索页面，带上职位分类参数
  router.push({
    path: '/code/enterprise/talent-search',
    query: { 
      category: category.name,
      categoryId: category.id 
    }
  })
}

const viewAllJobs = () => {
  ElMessage.success(t('enterpriseHome.loadingAllJobs'))
  // 跳转到职位搜索页面
  router.push('/code/enterprise/talent-search')
}

// 发布需求相关方法
const discoverTalents = () => {
  ElMessage.success(t('enterpriseHome.goingToPublishDemand'))
  // 跳转到需求发布页面
  router.push('/code/enterprise/space')
}

// 企业认证相关方法
const learnMoreCulture = () => {
  ElMessage.success(t('enterpriseHome.goingToCertification'))
  router.push({ name: 'enterprise-certification' })
}

// Footer相关方法
const openSocialMedia = (platform) => {
  ElMessage.success(t('enterpriseHome.openingSocialMedia', { platform }))
  // 这里可以添加实际的社交媒体链接
}

const downloadApp = () => {
  ElMessage.success(t('enterpriseHome.goingToWechatMiniProgram'))
  // 可以跳转到小程序二维码页面
}

const visitOfficialWebsite = () => {
  ElMessage.success(t('enterpriseHome.goingToOfficialWebsite'))
  // 跳转到官网绑定页面
}

const goToPage = (page) => {
  ElMessage.success(t('enterpriseHome.goingToPage', { page }))
  switch(page) {
    case 'enterprise':
      router.push('/code/enterprise1/home')
      break
    case 'student':
      router.push('/xueshengdenglu')
      break
    case 'about':
      router.push('/code/enterprise/info')
      break
    case 'talent':
      router.push('/code/enterprise/talent-search')
      break
  }
}

const scrollToTop = () => {
  window.scrollTo({
    top: 0,
    behavior: 'smooth'
  })
}
</script>

<style scoped>
/* 整体容器 */
.enterprise-home {
  min-height: 100vh;
  background: white;
}

/* 顶部导航栏 */
.header {
  width: 100%;
  height: 64px;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
}

.header-container {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-image {
  width: 40px;
  height: 40px;
}

.logo-text {
  font-family: "华文隶书", "STLiti", serif;
  font-size: 20px;
  font-weight: bold;
  color: #333;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-left: auto;
  margin-right: auto;
}

.nav-item {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  transition: color 0.3s ease;
  padding: 8px 16px;
  border-radius: 4px;
}

.nav-item:hover,
.nav-item.active {
  color: #1890ff;
}

.header-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}



.btn-login {
  padding: 8px 20px;
  border-radius: 20px;
  background: #1890ff;
  border: 1px solid #1890ff;
  color: white;
  font-size: 14px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-login:hover {
  background: #40a9ff;
  border-color: #40a9ff;
}

/* 用户操作按钮样式 */
.user-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.notification-bell {
  color: black;
  cursor: pointer;
  transition: color 0.3s ease;
}

.notification-bell:hover {
  color: #1890ff;
}

.action-item {
  color: black;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.action-item:hover {
  color: #1890ff;
  background: rgba(255, 255, 255, 0.1);
}

/* 主横幅区域 */
.hero-section {
  width: 100%;
  height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 轮播图背景 */
.banner-carousel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.banner-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1s ease;
  z-index: 1;
}

.banner-slide.active {
  opacity: 1;
  z-index: 2;
}

/* 没有背景图时的默认背景 */
.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(133deg, rgba(94,24,160,1) 0%, rgba(4,25,109,1) 53%, rgba(13,0,84,1) 100%);
  z-index: 0;
}

/* 轮播指示器 */
.banner-indicators {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 15; /* 提高z-index，确保指示器在蒙版之上 */
}

.banner-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
}

.banner-indicator.active {
  background: white;
  transform: scale(1.2);
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 1200px;
  width: 100%;
  padding: 0 20px;
  position: relative;
  z-index: 10; /* 提高z-index，确保内容在蒙版之上 */
}

/* 主标题图片 */
.hero-title {
  margin-bottom: 60px;
}

.title-image {
  width: 500px;
  height: 200px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* 搜索框区域 */
.search-container {
  width: 100%;
  display: flex;
  justify-content: center;
}

.search-box {
  width: 100%;
  max-width: 800px;
  height: 64px;
  background: white;
  border-radius: 32px;
  display: flex;
  align-items: center;
  padding: 8px 8px 8px 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
}

.search-input :deep(.el-input__wrapper) {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

.search-input :deep(.el-input__inner) {
  border: none;
  background: transparent;
  font-size: 16px;
  color: #666;
}

.search-input :deep(.el-input__inner::placeholder) {
  color: #999;
}

.search-button {
  width: 48px;
  height: 48px;
  background: #4A90E2;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-button:hover {
  background: #357ABD;
  transform: scale(1.05);
}

.search-button .el-icon {
  color: white;
  font-size: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .header-container {
    padding: 0 16px;
  }
  
  .nav-menu {
    gap: 20px;
  }
  
  .nav-item {
    font-size: 14px;
    padding: 6px 12px;
  }
  
  .hero-content {
    padding: 0 16px;
  }
  
  .title-image {
    width: 350px;
    height: 140px;
  }
  
  .search-box {
    max-width: 600px;
    height: 56px;
  }
  
  .search-button {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .nav-menu {
    gap: 16px;
  }
  
  .nav-item {
    font-size: 13px;
    padding: 4px 8px;
  }
  
  .header-buttons {
    gap: 8px;
  }
  
  .btn-login {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .title-image {
    width: 280px;
    height: 112px;
  }
  
  .search-box {
    max-width: 90%;
    height: 48px;
    padding: 6px 6px 6px 20px;
  }
  
  .search-button {
    width: 36px;
    height: 36px;
  }
}

/* 使命愿景区域样式 */
.mission-section {
  width: 100%;
  padding: 100px 0;
  background: white;
}

.mission-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
}

.mission-title {
  font-size: 48px;
  font-weight: bold;
  background: linear-gradient(90deg, #1890ff 0%, #722ed1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 30px;
  line-height: 1.2;
}



.mission-description {
  font-size: 16px;
  color: #666;
  line-height: 1.8;
  max-width: 800px;
  margin: 0 auto 50px auto;
  text-align: center;
  padding: 0 20px;
}

.mission-btn {
  padding: 15px 40px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 25px;
  background: linear-gradient(90deg, #722ed1 0%, #9254de 100%);
  border: none;
  color: white;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(114, 46, 209, 0.3);
}

.mission-btn:hover {
  background: linear-gradient(90deg, #9254de 0%, #b37feb 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(114, 46, 209, 0.4);
}

/* 服务特色区域样式 */
.service-features-section {
  width: 100%;
  padding: 80px 0;
  background: #f8f9fa;
}

.service-features-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.service-cards-grid {
  display: flex;
  height: 500px;
  padding: 0 20px;
  gap: 2px;
  /* 允许卡片展开时不受限制 */
  position: relative;
}

/* 当有卡片悬停时，其他卡片缩小 */
.service-cards-grid:hover .service-card:not(:hover) {
  width: 20%;
  transition: all 0.3s ease;
  opacity: 0.7;
}

.service-card {
  position: relative;
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 1;
  /* 默认状态下只显示1/3宽度的内容，不是压缩而是裁剪 */
  width: 33.33%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.service-card:hover {
  /* 悬停时适度展开，不完全遮住其他卡片 */
  width: 55%;
  z-index: 10;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  transform: scale(1.02);
  opacity: 1;
}

.card-background {
  position: absolute;
  top: 0;
  left: 0;
  /* 背景应该始终覆盖完整的卡片区域，即使在裁剪状态下 */
  width: 180%;
  height: 100%;
  overflow: hidden;
  transition: all 0.5s ease;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  transition: all 0.5s ease;
}

/* 悬停时背景图像效果 */
.service-card:hover .card-background {
  width: 100%;
}

.service-card:hover .card-image {
  object-position: center;
  filter: brightness(1.1) contrast(1.05);
}

.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 100%);
  transition: all 0.3s ease;
}

/* 悬停时覆盖层效果 */
.service-card:hover .card-overlay {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.05) 100%);
}

.card-content {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px 15px;
  text-align: center;
  transition: all 0.5s ease;
  /* 在裁剪状态下确保内容在可见区域内 */
  width: 100%;
}

/* 悬停时调整内边距 */
.service-card:hover .card-content {
  padding: 30px 20px;
}

.card-title {
  color: black;
  font-size: 22px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
  margin-bottom: 15px;
  transition: all 0.3s ease;
  /* 允许文本换行，确保所有文本都能显示 */
  white-space: normal;
  overflow: visible;
}

/* 悬停时标题样式调整 */
.service-card:hover .card-title {
  font-size: 28px;
  text-shadow: 3px 3px 6px rgba(255, 255, 255, 0.9);
  margin-bottom: 20px;
}

.vertical-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 4px; /* 减小字间距，确保长文本能够显示 */
  font-size: 20px; /* 调整字体大小 */
  transition: all 0.3s ease;
  max-height: 300px; /* 确保文本不会超出卡片 */
  overflow: hidden;
}

/* 悬停时垂直文字样式调整 */
.service-card:hover .vertical-text {
  letter-spacing: 6px; /* 减小悬停时的字间距 */
}

.card-description {
  color: black;
  font-size: 14px;
  line-height: 1.4;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
  max-width: 150px; /* 增加宽度，确保英文文本能够显示 */
  writing-mode: horizontal-tb;
  transition: all 0.3s ease;
  /* 在裁剪状态下隐藏描述文本 */
  opacity: 0;
  transform: translateX(-20px);
}

/* 悬停时描述文本样式调整 */
.service-card:hover .card-description {
  font-size: 16px;
  opacity: 1;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.9);
  max-width: 250px; /* 增加悬停时的宽度 */
  transform: translateX(0);
}

/* 特定卡片样式 */
.talent-card {
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.resource-card {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.service-card-wide {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.security-card {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* 盾牌图标样式 */
.card-icon {
  margin-top: 20px;
}

.shield-icon {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.2);
  border: 3px solid white;
  border-radius: 10px;
  position: relative;
}

.shield-icon::before {
  content: '🛡️';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
}

/* 全球人才库区域样式 */
.global-talent-section {
  width: 100%;
  padding: 80px 0;
  background: white;
}

.talent-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.talent-header {
  text-align: center;
  margin-bottom: 60px;
}

.talent-title {
  font-size: 36px;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
}

.talent-subtitle {
  font-size: 32px;
  font-weight: bold;
  background: linear-gradient(90deg, #1890ff 0%, #722ed1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin: 0;
}

.talent-carousel-wrapper {
  position: relative;
  width: 100%;
}

.talent-carousel-container {
  width: 100%;
  position: relative;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.talent-carousel-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  width: 100%;
  position: relative;
}

.talent-card {
  flex-shrink: 0;
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 中心位置的人才 - 放大显示 */
.talent-card.is-center {
  transform: scale(1.3);
  z-index: 10;
}

.talent-card.is-center .talent-image-container {
  width: 130px;
  height: 130px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

/* 侧边的人才 - 正常大小但略微透明 */
.talent-card.is-side {
  transform: scale(0.8);
  opacity: 0.7;
  z-index: 5;
}

.talent-card.is-side .talent-image-container {
  width: 100px;
  height: 100px;
}

/* 左右两边的人才进一步缩小 */
.talent-card.is-left:first-child,
.talent-card.is-right:last-child {
  transform: scale(0.6);
  opacity: 0.4;
  z-index: 1;
}

.talent-image-container {
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  transition: all 0.5s ease;
  cursor: pointer;
}

.talent-card:hover .talent-image-container {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.talent-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.talent-name {
  margin-top: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  text-align: center;
  white-space: nowrap;
  background: linear-gradient(90deg, #1890ff 0%, #722ed1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.talent-nav-controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 40px;
}

.talent-nav-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: white;
  border: 2px solid #e0e0e0;
  color: #666;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.talent-nav-btn:hover {
  background: #1890ff;
  color: white;
  border-color: #1890ff;
  transform: scale(1.1);
}

/* 职位筛选区域样式 */
.job-filter-section {
  width: 100%;
  padding: 80px 0;
  background: #f8f9fa;
}

.job-filter-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.job-filter-header {
  text-align: center;
  margin-bottom: 60px;
}

.job-filter-title {
  font-size: 36px;
  font-weight: bold;
  color: #333;
  margin: 0;
}

.highlight-text {
  background: linear-gradient(90deg, #1890ff 0%, #722ed1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.job-categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 60px;
}

.job-category-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.job-category-card:hover {
  border-color: #1890ff;
  box-shadow: 0 8px 24px rgba(24, 144, 255, 0.12);
  transform: translateY(-2px);
}

.category-name {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  flex: 1;
}

.category-arrow {
  font-size: 16px;
  color: #999;
  transition: all 0.3s ease;
}

.job-category-card:hover .category-arrow {
  color: #1890ff;
  transform: translateX(4px);
}

.view-all-jobs {
  text-align: center;
}

.view-all-btn {
  padding: 16px 40px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 50px;
  background: linear-gradient(135deg, #1890ff 0%, #722ed1 100%);
  border: none;
  box-shadow: 0 8px 24px rgba(24, 144, 255, 0.3);
  transition: all 0.3s ease;
}

.view-all-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(24, 144, 255, 0.4);
}

.ml-2 {
  margin-left: 8px;
}

/* 发现国际精英介绍区域样式 */
.discover-talent-section {
  width: 100%;
  padding: 100px 0;
  background: white;
}

.discover-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.discover-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: left;
}

.discover-title {
  font-size: 48px;
  font-weight: bold;
  color: #333;
  line-height: 1.2;
  margin-bottom: 40px;
}



.discover-description {
  margin-bottom: 50px;
}

.desc-text {
  font-size: 16px;
  color: #666;
  line-height: 1.8;
  margin-bottom: 12px;
  text-align: justify;
}

.desc-text:last-child {
  margin-bottom: 0;
}

.discover-action {
  margin-top: 50px;
}

.discover-btn {
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 50px;
  background: linear-gradient(135deg, #1890ff 0%, #722ed1 100%);
  border: none;
  box-shadow: 0 8px 24px rgba(24, 144, 255, 0.3);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.discover-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(24, 144, 255, 0.4);
}

/* 我们的文化区域样式 */
.our-culture-section {
  width: 100%;
  padding: 100px 0;
  background: #f8f9fa;
}

.culture-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.culture-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}

.culture-content {
  padding-right: 40px;
}

.culture-title {
  font-size: 48px;
  font-weight: bold;
  color: #333;
  line-height: 1.2;
  margin-bottom: 40px;
}



.culture-description {
  margin-bottom: 50px;
}

.culture-text {
  font-size: 16px;
  color: #666;
  line-height: 1.8;
  margin-bottom: 8px;
}

.culture-text:last-child {
  margin-bottom: 0;
}

.culture-action {
  margin-top: 50px;
}

.culture-btn {
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 50px;
  background: linear-gradient(135deg, #722ed1 0%, #1890ff 100%);
  border: none;
  box-shadow: 0 8px 24px rgba(114, 46, 209, 0.3);
  transition: all 0.3s ease;
}

.culture-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(114, 46, 209, 0.4);
}

.culture-images {
  position: relative;
}

.images-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  height: 400px;
}

.image-item {
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
}

.image-item:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.team-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: all 0.3s ease;
}

.image-item:hover .team-image {
  transform: scale(1.05);
}

/* 图片布局调整 */
.image-1 {
  grid-row: 1 / 2;
}

.image-2 {
  grid-row: 1 / 2;
}

.image-3 {
  grid-row: 2 / 3;
}

.image-4 {
  grid-row: 2 / 3;
}

/* 我们的承诺区域样式 */
.our-promise-section {
  width: 100%;
  padding: 100px 0;
  background: white;
  text-align: center;
}

.promise-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.promise-title {
  font-size: 48px;
  font-weight: bold;
  color: #333;
  margin-bottom: 60px;
}

.promise-content {
  max-width: 800px;
  margin: 0 auto;
}

.promise-text {
  font-size: 16px;
  color: #666;
  line-height: 1.8;
  margin-bottom: 8px;
  text-align: center;
}

.promise-highlight {
  font-size: 18px;
  color: #333;
  font-weight: 600;
  line-height: 1.8;
  margin-top: 40px;
  text-align: center;
}

/* Footer样式 */
.main-footer {
  background: #2c2c2c;
  color: white;
  padding: 40px 0 20px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 80px;
  align-items: flex-start;
}

/* 左侧：社交媒体和版权信息 */
.footer-left {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.social-section {
  text-align: left;
}

.follow-text {
  font-size: 14px;
  color: #ccc;
  margin-bottom: 15px;
}

.social-links {
  display: flex;
  gap: 10px;
}

.social-link {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid #555;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.3s ease;
}

.social-link.tiktok {
  background: #000;
}

.social-link.wechat {
  background: #1AAD19;
}

.social-link.weibo {
  background: #E6162D;
}

.social-link.qq {
  background: #12B7F5;
}

.social-link:hover {
  transform: scale(1.1);
}

.social-icon-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  /* 暂时移除滤镜以确保图标可见 */
}

.copyright-section {
  margin-top: auto;
}

.copyright-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #999;
}

.copyright-icon {
  font-size: 12px;
}

/* 中间：联系我们 */
.footer-center {
  text-align: center;
  min-width: 120px;
}

.contact-title {
  font-size: 16px;
  color: white;
  margin: 0;
  font-weight: 400;
}

/* 右侧：按钮、相关网站和回到顶部 */
.footer-right {
  display: flex;
  align-items: flex-start;
  gap: 40px;
}

.footer-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-btn {
  background: #555;
  border: none;
  color: #ccc;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  white-space: nowrap;
  min-width: 120px;
}

.footer-btn:hover {
  background: #666;
  color: white;
}

.sites-section {
  text-align: left;
}

.sites-title {
  font-size: 16px;
  color: white;
  margin-bottom: 15px;
  font-weight: 400;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.nav-link {
  color: #ccc;
  text-decoration: none;
  font-size: 12px;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: white;
}

.back-to-top {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid #666;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.back-to-top:hover {
  background: #555;
  transform: translateY(-2px);
}

/* 公告栏区域样式 */
.announcement-section {
  width: 100%;
  padding: 80px 0;
  background: #f8f9fa;
}

.announcement-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.announcement-title {
  font-size: 48px;
  font-weight: bold;
  color: #333;
  margin-bottom: 40px;
  text-align: left;
}

.carousel-wrapper {
  position: relative;
  width: 100%;
}

.carousel-container {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.carousel-track {
  display: flex;
  transition: transform 0.3s ease;
  gap: 40px;
}

.announcement-card {
  display: flex;
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  height: 350px;
  width: 800px;
  flex-shrink: 0;
}

.announcement-image {
  width: 400px;
  height: 100%;
  overflow: hidden;
  flex-shrink: 0;
}

.announcement-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.announcement-content {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.announcement-card-title {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  margin-bottom: 20px;
  line-height: 1.4;
}

.announcement-description {
  font-size: 16px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 30px;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
}

.learn-more-btn {
  align-self: flex-start;
  padding: 12px 24px;
  border-radius: 25px;
  background: #1890ff;
  border: none;
  color: white;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.learn-more-btn:hover {
  background: #40a9ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
}

/* 导航控制区域 */
.carousel-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
  padding: 0 20px;
}

/* 导航按钮样式 */
.carousel-nav {
  display: flex;
  gap: 16px;
}

.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e0e0e0;
  color: #666;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-btn:hover {
  background: white;
  color: #1890ff;
  border-color: #1890ff;
  transform: scale(1.05);
}

/* 指示器样式 */
.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ddd;
  cursor: pointer;
  transition: all 0.3s ease;
}

.indicator:hover,
.indicator.active {
  background: #1890ff;
  transform: scale(1.2);
}

/* 弹窗样式 */
.announcement-detail {
  max-height: 70vh;
  overflow-y: auto;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  margin-bottom: 30px;
  gap: 20px;
}

.detail-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
}

.detail-title {
  font-size: 20px;
  font-weight: bold;
  color: #333;
  line-height: 1.4;
  margin: 0;
  flex: 1;
}

.detail-content {
  margin-bottom: 30px;
}

.announcement-full-content h4 {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin: 20px 0 10px 0;
}

.announcement-full-content h5 {
  font-size: 16px;
  font-weight: 600;
  color: #555;
  margin: 15px 0 8px 0;
}

.announcement-full-content ul {
  margin: 10px 0;
  padding-left: 20px;
}

.announcement-full-content li {
  margin: 5px 0;
  color: #666;
  line-height: 1.5;
}

.announcement-full-content p {
  color: #666;
  line-height: 1.6;
  margin: 10px 0;
}

.tech-requirements {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.tech-requirements th,
.tech-requirements td {
  border: 1px solid #ddd;
  padding: 12px;
  text-align: left;
}

.tech-requirements th {
  background: #f5f5f5;
  font-weight: bold;
  color: #333;
}

.tech-requirements td {
  color: #666;
}

.detail-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .mission-section {
    padding: 80px 0;
  }
  
  .mission-title {
    font-size: 36px;
  }
  

  
  .mission-description {
    font-size: 15px;
    max-width: 90%;
  }
  
  .mission-btn {
    padding: 12px 30px;
    font-size: 15px;
  }
  
  .service-features-section {
    padding: 60px 0;
  }
  
  .service-cards-grid {
    flex-direction: column;
    height: auto;
    gap: 10px;
    padding: 0 10px;
  }
  
  .service-card {
    height: 200px;
    width: 100% !important;
  }
  
  /* 移动端时禁用截断效果 */
  .service-cards-grid:hover .service-card:not(:hover) {
    width: 100% !important;
    opacity: 1;
  }
  
  .card-title {
    font-size: 24px;
    letter-spacing: 4px;
  }
  
  .card-description {
    font-size: 14px;
    max-width: 150px;
  }
  
  .global-talent-section {
    padding: 60px 0;
  }
  
  .talent-title {
    font-size: 28px;
  }
  
  .talent-subtitle {
    font-size: 24px;
  }
  
  .talent-carousel-container {
    height: 150px;
  }
  
  .talent-card.is-center .talent-image-container {
    width: 100px;
    height: 100px;
  }
  
  .talent-card.is-side .talent-image-container {
    width: 80px;
    height: 80px;
  }
  
  .talent-name {
    font-size: 14px;
    margin-top: 8px;
  }
  
  .talent-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  
  .job-filter-section {
    padding: 60px 0;
  }
  
  .job-filter-title {
    font-size: 28px;
  }
  
  .job-categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 40px;
  }
  
  .job-category-card {
    padding: 20px 16px;
  }
  
  .category-name {
    font-size: 14px;
  }
  
  .view-all-btn {
    padding: 14px 32px;
    font-size: 14px;
  }
  
  .discover-talent-section {
    padding: 60px 0;
  }
  
  .discover-title {
    font-size: 32px;
    margin-bottom: 30px;
  }
  
  .desc-text {
    font-size: 14px;
    line-height: 1.6;
  }
  
  .discover-btn {
    padding: 14px 24px;
    font-size: 14px;
  }
  
  .our-culture-section {
    padding: 60px 0;
  }
  
  .culture-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  
  .culture-content {
    padding-right: 0;
    text-align: center;
  }
  
  .culture-title {
    font-size: 32px;
    margin-bottom: 30px;
  }
  
  .culture-text {
    font-size: 14px;
    line-height: 1.6;
  }
  
  .culture-btn {
    padding: 14px 24px;
    font-size: 14px;
  }
  
  .images-grid {
    height: 300px;
    gap: 10px;
  }
  
  .our-promise-section {
    padding: 60px 0;
  }
  
  .promise-title {
    font-size: 32px;
    margin-bottom: 40px;
  }
  
  .promise-text,
  .promise-highlight {
    font-size: 14px;
    line-height: 1.6;
  }
  
  .main-footer {
    padding: 30px 0 15px;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    gap: 25px;
    text-align: center;
  }
  
  .footer-left {
    order: 1;
  }
  
  .footer-center {
    order: 2;
  }
  
  .footer-right {
    order: 3;
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }
  
  .social-section,
  .sites-section {
    text-align: center;
  }
  
  .social-links {
    justify-content: center;
  }
  
  .nav-links {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
  }
  
  .footer-buttons {
    align-items: center;
    order: 1;
  }
  
  .sites-section {
    order: 2;
  }
  
  .back-to-top {
    order: 3;
    margin: 0;
  }
  
  .announcement-section {
    padding: 60px 0;
  }
  
  .announcement-title {
    font-size: 36px;
    text-align: center;
  }
  
  .carousel-track {
    gap: 20px;
  }

  .announcement-card {
    flex-direction: column;
    height: auto;
    width: 90%;
    min-width: 300px;
  }
  
  .carousel-controls {
    flex-direction: column;
    gap: 20px;
    padding: 0 10px;
  }
  
  .nav-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  
  .announcement-image {
    width: 100%;
    height: 200px;
  }
  
  .announcement-content {
    padding: 30px 20px;
  }
  
  .announcement-card-title {
    font-size: 20px;
  }
  
  .announcement-description {
    font-size: 14px;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
  
  .detail-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .detail-image {
    width: 100px;
    height: 100px;
  }
}

/* 轮播图加载状态 */
.banner-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(133deg, rgba(94,24,160,0.8) 0%, rgba(4,25,109,0.8) 53%, rgba(13,0,84,0.8) 100%);
  z-index: 1;
}

.loading-icon {
  font-size: 48px;
  color: white;
  animation: rotate 2s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* 整个轮播图区域的蒙版 */
.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.25); /* 半透明黑色蒙版 */
  z-index: 3; /* 确保在轮播图之上，但在内容之下 */
  pointer-events: none; /* 确保点击事件穿透蒙版 */
}
</style>